package day8;

import java.util.Scanner;

public abstract interface Computer {
    int compute(int n, int m);

class Add implements Computer {
    @Override
    public int compute(int n, int m) {
        System.out.print(n+"+"+m);
        return n + m;
    }
}

class Minus implements Computer {
    @Override
    public int compute(int n, int m) {
        System.out.print(n+"-"+m);
        return n - m;
    }
}

class Multiply implements Computer {
    @Override
    public int compute(int n, int m) {
        System.out.print(n+"*"+m);
        return n * m;
    }
}

class Except implements Computer {
    @Override
    public int compute(int n, int m) {
        System.out.print(n+"/"+m);
        return n / m;
    }
}

class UseComputer {
    public void useCom(Computer com, int one, int two) {
        int result = com.compute(one, two);
        System.out.println("=" + result);
    }
}

class Test7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入第一个数：");
        int one = sc.nextInt();
        System.out.print("请输入第二个数：");
        int two = sc.nextInt();

        UseComputer uc = new UseComputer();

        Computer add = new Add();
        uc.useCom(add, one, two);

        Computer minus = new Minus();
        uc.useCom(minus, one, two);

        Computer multiply = new Multiply();
        uc.useCom(multiply, one, two);

        Computer except = new Except();
        uc.useCom(except, one, two);
    }
}
}